"""Order URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
from web.views import account
from web.views import level
from web.views import customer
from web.views import policy
from web.views import order
from web.views import transaction

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^login.html$', account.login, name='login'),
    url(r'^sms/login.html$', account.sms_login, name='sms_login'),
    url(r'^sms_send.html$', account.sms_send, name='sms_send'),
    url(r'^home.html$', account.home, name='home'),
    url(r'^logout.html$', account.logout, name='logout'),

    # 级别管理
    url(r'^level/list.html$', level.level_list, name='level_list'),
    url('level/add.html', level.level_add, name='level_add'),  # 使用正则表达式匹配的无法用name反向生成
    url('level/edit/(?P<pk>\d+).html', level.level_edit, name='level_edit'),  # 编辑级别
    url('level/delete/(?P<pk>\d+).html', level.level_delete, name='level_delete'),  # 删除级别

    # 测试url
    url(r'^user.html$', account.user, name='user'),

    # 用户管理
    url('customer/list.html', customer.customer_list, name='customer_list'),
    url('customer/add.html', customer.customer_add, name='customer_add'),  # 添加用户
    url('customer/edit/(?P<pk>\d+).html', customer.customer_edit, name='customer_edit'),  # 编辑用户
    url('customer/reset/(?P<pk>\d+).html', customer.customer_reset, name='customer_reset'),  # 密码重置
    url('customer/delete.html', customer.customer_delete, name='customer_delete'),  # 删除用户
    url('customer/list/order/(?P<pk>\d+).html', customer.customer_list_order, name='customer_list_order'),  # 订单管理

    # 价格策略管理
    url('policy/list.html', policy.policy_list, name='policy_list'),  # 策略列表
    url('policy/add.html', policy.policy_add, name='policy_add'),  # 添加策略
    url('policy/edit/(?P<pk>\d+).html', policy.policy_edit, name='policy_edit'),  # 编辑策略
    url('policy/delete.html', policy.policy_delete, name='policy_delete'),  # 编辑策略

    # 客户订单管理
    url('order/list.html', order.order_list, name='order_list'),  # 订单列表
    url('order/list/add.html', order.order_list_add, name='order_list_add'),  # 添加订单
    url('order/list/cancel/(?P<pk>\d+).html', order.order_list_cancel, name='order_list_cancel'),  # 撤单管理

    # 客户交易列表
    url('transaction/list.html', transaction.transaction_list, name='transaction_list'),  # 添加订单

]
